var fnv = require('fnv-plus');
var path = require('path');
var int64_util = require('thrift/lib/nodejs/lib/thrift/int64_util');

// var sqlite3 = require('sqlite3');
// var db = new sqlite3.Database('NoteDB.sqlite3'); 
// var dbs = require('./egg-sqlite-async/main');
const dbs = require(path.join(__dirname, './asqlite3'));

module.exports = {
	mod(id, num) {
	  return fnv.hash(id, 64).dec() % num;
	},
	// int64_util = require('thrift/lib/nodejs/lib/thrift/int64_util'),
	// getdb() {
	// 	return db;   
	// },
	async conn() {
		var db = await dbs.open('NoteDB.sqlite3');
		var data = await db.get('select * from Note;');
		return data;
	}
};